package com.adv.ems.model.vo;

import com.adv.ems.db.entity.InstituteInfoDO;
import com.adv.ems.utils.EmsUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.List;

@Data
public class BaseInstituteVO {
    private List<Info> list;

    public BaseInstituteVO() {
        this.list = new ArrayList<Info>();
    }

    @AllArgsConstructor
    @NoArgsConstructor
    @Data
    public static class Info {
        private java.lang.Long id;
        private java.lang.Long parentId;
        private java.lang.String parentName;
        private java.lang.String nameInfo;
        private java.lang.String code;
        private java.lang.String path;
        private java.lang.String managerInfo;
        private java.lang.String profile;
        private java.lang.String address;
        private java.lang.String logo;
        private java.lang.String imgsInfo;
        private java.lang.String telephone;
        private java.lang.String mobilePhone;
        private java.lang.String pepoleAmountInfo;
        private java.lang.String bizInfo;
        private java.lang.String cityInfo;
        private java.lang.String satelliteLocation;
        private java.lang.String ext;
        private java.lang.Double totalSize;
        private java.lang.Double buildingSize;
        private java.lang.Double incomeYear;
        private java.util.Date updateTime;
        private java.util.Date createTime;

        public Info(InstituteInfoDO instituteInfo, InstituteInfoDO parent, String acceptLanguage) {
            BeanUtils.copyProperties(instituteInfo, this);
            if (parent != null) {
                this.setParentName(EmsUtil.getNameInfo(parent.getNameInfo(), acceptLanguage).getShortName());
            }
        }
    }
}
